package com.vr.xuecheng.feign.fallback;

import com.vr.xuecheng.feign.client.CourseIndexClient;
import com.vr.xuecheng.feign.response.Result;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @author hzh
 * @date 2025/03/22
 * 保存索引熔断降级后的回调
 */
@Component
public class CourseIndexFallbackFactory implements FallbackFactory<CourseIndexClient> {
    @Override
    public CourseIndexClient create(Throwable cause) {
        return courseIndex -> Result.error("调用课程索引服务失败",cause.getMessage());
    }
}
